const Router = require('koa-router');


const router = Router();

const auth = require('../middleware/auth')

const User = require('../controllers/user.controller')



router
  .post('/insert', User.addUser)//添加用户
  .post('/login', User.loginUser)//用户登录
  .post('/update',auth(),User.updateUser) //更新用户资料
  //ctx.params.id
  // .get('/user/:id',auth(),User.currentUser) //获取当前用户
  //ctx.request.query.id
  .get('/user',auth(),User.currentUser) //获取当前用户
  .post('/delete',auth(),User.deleteUser) //删除用户  
  .get('/all',auth({required:false}),User.allUser) //删除用户  

  .post('/follower',auth(),User.addFollower) //删除用户  
  .post('/unfollower',auth(),User.unFollower) //删除用户  
module.exports = router